//
//  NSObject+CommonTool.m
//  iOS实战
//
//  Created by clz on 2019/10/27.
//  Copyright © 2019 clz. All rights reserved.
//

#import "NSObject+CommonTool.h"

@implementation NSObject (CommonTool)

- (NSString *)filterData:(id)data{
    if (data && ![data isKindOfClass:[NSNull class]]) {
        if ([data isKindOfClass:[NSString class]]) {
            return data;
        }else if ([data isKindOfClass:[NSNumber class]]){
            return ((NSNumber *)data).stringValue;
        }
    }
    return @"";
}

- (NSString *)getDateStrWithTimeStamp:(NSTimeInterval)timeStamp formatter:(NSDateFormatter *)formatter{

    NSTimeInterval interval = timeStamp / 1000.0;
    NSDate *date = [NSDate dateWithTimeIntervalSince1970:interval];
    NSString *dateString = [formatter stringFromDate: date];
    return dateString;
}


@end
